﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using ZBJF.Warranty.BLL.Cached;

namespace ZBJF.Warranty.WebApiSite.Filter
{
    public class ZBJFProviderAuthenticationAttribute:BaseAuthenticationAttribute
    {
        public string SecrectKey { get; set; }
        public string VendorID { get; set; }
        protected override string GetSecrectKey(string keyValue)
        {
            var apiConfig = AppConfigCached.GetApiPlatformConfig(keyValue);
            if (apiConfig != null)
                SecrectKey = apiConfig.SecrectKey;
            return SecrectKey;
        }
        protected override string GetVendorID(string keyValue)
        {
            var apiConfig = AppConfigCached.GetApiPlatformConfig(keyValue);
            if (apiConfig != null)
                VendorID = apiConfig.VendorID;
            return VendorID;
        }
    }
}